// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
  Throw a TypeError exception if IsConstructor(superclass) is false (async arrow)
info: |
  Runtime Semantics: ClassDefinitionEvaluation

  ClassTail : ClassHeritage { ClassBody }
      ...

  5. Else,
      Set the running execution context's LexicalEnvironment to classScope.
      Let superclassRef be the result of evaluating ClassHeritage.
      Set the running execution context's LexicalEnvironment to env.
      Let superclass be ? GetValue(superclassRef).
      If superclass is null, then
          Let protoParent be null.
          Let constructorParent be %Function.prototype%.
      Else if IsConstructor(superclass) is false, throw a TypeError exception.
      ...
features: [class]
---*/


function Test() {
    assert.throws(TypeError, () => {
      var C = class extends (async () => {}) {};
    });

}

// preheat
const NUMBER_OF_PREHEAT = 1;
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}

ArkTools.jitCompileAsync(Test);
assert.sameValue(ArkTools.waitJitCompileFinish(Test), true, '[JIT] JIT disabled.');

// test
const NUMBER_OF_TEST = 1; // or 2
for (let i = 0; i < NUMBER_OF_TEST; i++) {
    Test();
}
